﻿using DigitalHealth.PACS.ChatWebSocket.Repositories;
using DigitalHealth.PACS.ChatWebSocket.Repositories.Imp;
using DigitalHealth.PACS.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DigitalHealth.PACS.ChatWebSocket.Services.Imp
{
    internal class ChatGroupServerImp : IChatGroupServer
    {
        public IChatGroupRepository chatGroupRepository { get; set; }

        public ChatGroupServerImp(IChatGroupRepository chatGroupRepository)
        {
            this.chatGroupRepository = chatGroupRepository;
        }

        public bool ChatUserExists(ChatGroup chatUser)
        {
            return chatGroupRepository.ChatGroupExists(chatUser.Id.ToString());
        }

        public void Create(ChatGroup chatUser)
        {
            chatGroupRepository.Create(chatUser);
        }

        public void Delete(ChatGroup chatUser)
        {
            chatGroupRepository.Delete(chatUser);
        }

        public ChatGroup GetChatGroupById(string id)
        {
            return chatGroupRepository.GetChatGroupById(id);
        }

        public IEnumerable<ChatGroup> GetChatGroupByUser(ChatUser chatUser)
        {
            return chatGroupRepository.GetChatGroupByChatUser(chatUser);
        }

        public IEnumerable<ChatGroup> GetChatGroups()
        {
            return chatGroupRepository.GetChatGroup();
        }

        public void Update(ChatGroup chatUser)
        {
            chatGroupRepository.Update(chatUser);
        }
    }
}
